﻿using System;


namespace MathLib
{
    /// <summary>
    /// 加法
    /// </summary>
    internal class AddMath : IMath
    {
        public decimal Calculate(decimal a, decimal b)
        {
            return a + b;
        }
    }

    /// <summary>
    /// 减法
    /// </summary>
    internal class SubtractMath : IMath
    {
        public decimal Calculate(decimal a, decimal b)
        {
            return a - b;
        }
    }

    /// <summary>
    /// 乘法
    /// </summary>
    internal class MultiplyMath : IMath
    {
        public decimal Calculate(decimal a, decimal b)
        {
            return a * b;
        }
    }

    /// <summary>
    /// 除法
    /// </summary>
    internal class DivideMath : IMath
    {
        public decimal Calculate(decimal a, decimal b)
        {
            if (b == 0)
            {
                throw new DivideByZeroException("除数不可以为零");
            }
            return a / b;
        }
    }


    /// <summary>
    /// 组合
    /// </summary>
    internal class CompoundedMath : IMath
    {
        public decimal Calculate(decimal a, decimal b)
        {
           throw new NotImplementedException("组合计算未实行");
        }
    }
}
